Retrieves the top, left, bottom, and right margins of a ToolTip control
#include <GuiToolTip.au3>
_GUIToolTip_GetMargin ( $hWnd )
| $hWnd | Handle to the ToolTip control (returned by _GUIToolTip_Create.) |
#include <GUIConstantsEx.au3>
#include <GUIToolTip.au3>
#include <MsgBoxConstants.au3>
Example()
Func Example()
Local $hGUI = GUICreate(StringTrimRight(@ScriptName, 4), 350, 200)
Local $iAdd = GUICtrlCreateButton("Button ToolTip", 30, 32, 130, 28)
Local $hAdd = GUICtrlGetHandle($iAdd)
; Create a tooltip control
Local $hToolTip1 = _GUIToolTip_Create(0)
; If using a Windows theme setting, this will disable that for the tooltip displayed, so you can change
; the margins and have the change seen
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hToolTip1, "wstr", 0, "wstr", 0)
Local $hToolTip2 = _GUIToolTip_Create(0)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hToolTip2, "wstr", 0, "wstr", 0)
; This is only used because the tooltip is a multiline tool, you don't need this to change
; the margins
_GUIToolTip_SetMaxTipWidth($hToolTip1, 400)
_GUIToolTip_SetMaxTipWidth($hToolTip2, 400)
; Manually set the margins of the tooltip instead of using default settings.
_GUIToolTip_SetMargin($hToolTip1, 30, 10, 20, 12)
Local $aMargins = _GUIToolTip_GetMargin($hToolTip1)
Local $aMargins1 = _GUIToolTip_GetMargin($hToolTip2)
; Add a tool to the first tooltip control
_GUIToolTip_AddTool($hToolTip1, 0, 'Left : ' & $aMargins[0] & @LF & _
'Top : ' & $aMargins[1] & @LF & _
'Right : ' & $aMargins[2] & @LF & _
'Bottom : ' & $aMargins[3], $hAdd)
_GUIToolTip_SetTitle($hToolTip1, "This is the ToolTip with manually set margins")
; Add a tool to the second tooltip control
_GUIToolTip_AddTool($hToolTip2, 0, 'Left : ' & $aMargins1[0] & @LF & _
'Top : ' & $aMargins1[1] & @LF & _
'Right : ' & $aMargins1[2] & @LF & _
'Bottom : ' & $aMargins1[3], $hGUI)
_GUIToolTip_SetTitle($hToolTip2, "This is the ToolTip with default margins")
GUISetState()
While 1
If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
; Destroy the tooltip control
_GUIToolTip_Destroy($hToolTip1)
GUIDelete($hGUI)
EndFunc ;==>Example